WebGetCustomHeader

Note: This statement is only used in load test scripts. See Load Testing for more information.

Returns the header value set by a WebSetCustomHeader statement.

Syntax

WebGetCustomHeader("Header")

Arguments

Argument Description
Header Header name.

Return value

Value Description
Value Header value.

Example

'Gets existing custom headers and checks if AccessToken header exists

headers = WebGetAllCustomHeaders()

exists = False

For Each header in headers

If (header = "AccessToken"Then

exists = True

End If

Next

'Stores header value

token = ""

'If header exists, returns original value

If exists Then

token = WebGetCustomHeader("AccessToken")

End If

Try 'Sets custom header value to send with requests

WebSetCustomHeader("AccessToken""9a38a382-9c0a-4b42-9c54-3f7db7de66af")

WebGet("http://www.wysicorp.com/login.php")

Finally 'Resets original header value if header existed or removes header created in Try block

If exists Then

WebSetCustomHeader("AccessToken", token)

Else

WebRemoveCustomHeader("AccessToken")

End If

End Try